/*
 * HermiteSurface.cpp
 *
 *  Created on: 9 Nov 2013
 *      Author: Patrick
 */

#include <vector>

#include <OgreVector3.h>

#include <engine/datatypes/HermiteSurface.h>

namespace Engine {

HermiteSurface::~HermiteSurface() {
}

HermiteSurface::HermiteSurface(int Xsize, int Ysize) {
	this->Xsize = Xsize;
	this->Ysize = Ysize;

	this->surface.resize(this->Xsize);
	for(int i = 0; i < this->Xsize; i++) {
		this->surface[i].resize(this->Ysize);
	}
}

bool HermiteSurface::getPosition(int i, int j, Ogre::Vector3& pos) {

	if(i < 0 || i >= this->Xsize || j < 0 || j >= this->Ysize)
		return false;

	pos = this->surface[i][j].position;
	return true;
}

void HermiteSurface::setPosition(int i, int j, Ogre::Vector3 pos) {

	if(i < 0 || i >= this->Xsize || j < 0 || j >= this->Ysize)
		return;

	this->surface[i][j].position = Ogre::Vector3(pos);
}

bool HermiteSurface::getVerticalTangent(int i, int j, Ogre::Vector3& pos) {

	if(i < 0 || i >= this->Xsize || j < 0 || j >= this->Ysize)
		return false;

	pos = this->surface[i][j].verticalTangent;
	return true;
}

void HermiteSurface::setVerticalTangent(int i, int j, Ogre::Vector3 pos) {

	if(i < 0 || i >= this->Xsize || j < 0 || j >= this->Ysize)
		return;

	this->surface[i][j].verticalTangent =  Ogre::Vector3(pos);
}

bool HermiteSurface::getHorizontalTangent(int i, int j, Ogre::Vector3& pos) {

	if(i < 0 || i >= this->Xsize || j < 0 || j >= this->Ysize)
		return false;

	pos = this->surface[i][j].horizontalTangent;
	return true;
}

void HermiteSurface::setHorizontalTangent(int i, int j, Ogre::Vector3 pos) {

	if(i < 0 || i >= this->Xsize || j < 0 || j >= this->Ysize)
		return;

	this->surface[i][j].horizontalTangent =  Ogre::Vector3(pos);
}

int HermiteSurface::getXsize() {
	return this->Xsize;
}

int HermiteSurface::getYsize() {
	return this->Ysize;
}

} /* namespace Engine */
